//
//  EditPartner.m
//  Bespoke
//
//  Created by Cheng on 12/10/3.
//
//

#import "EditPartner.h"

@implementation EditPartner
@synthesize Bt_Cancel,Bt_Done,Tf_PartnerName,Tf_PartnerEmail;
@synthesize delegate;

- (IBAction)CancelPressed:(id)sender {
    [delegate CancelPressed_EditPartner];
}
- (IBAction)DonePressed:(id)sender {
    
    if ([Tf_PartnerName.text isEqualToString:@""]) {
        UIAlertView *AlertView = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Name is null." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [AlertView show];
        return;
    }
    if ([Tf_PartnerEmail.text isEqualToString:@""]) {
        UIAlertView *AlertView = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Email is null." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [AlertView show];
        return;
    }
    else if ([Tf_PartnerEmail.text rangeOfString:@"@"].location == NSNotFound) {
        UIAlertView *AlertView = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"The Email you entered is incorrect." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [AlertView show];
        return;
    }
    [delegate SavePartnerInfo:Tf_PartnerName.text SetPartnerEmail:Tf_PartnerEmail.text];
}

@end
